package com.lcxw.hxzbadmin.controller.roomcontroller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.lcxw.hxzbadmin.entity.requestbean.ForceStopRoomReq;
import com.lcxw.hxzbapi.controller.roomcontroller.RoomRealization;
import com.lcxw.hxzbapi.entity.pojo.YwpdRoom;
import com.lcxw.hxzbapi.entity.response.Response;
import com.lcxw.hxzbapi.service.YwpdRoomService;
import com.lcxw.hxzbapi.tencentim.common.ImCommand;
import com.lcxw.hxzbcommon.entity.ErrorCode;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/room/manage")
@Slf4j
public class RoomManagerController {

    @Resource
    RoomRealization roomRealization;

    /**
     * 管理员强制下播一个房间
     */
    @PostMapping("/forceStop")
    public Response forceStopRoom(@RequestBody ForceStopRoomReq forceStopRoomReq) {
        String adminName = forceStopRoomReq.getAdminName();
        long roomId = forceStopRoomReq.getRoomId();
        String reason = forceStopRoomReq.getReason();

        try {
            return roomRealization.forceStop(roomId, reason);
        } catch (Exception e) {
            return Response.dbFail(log, "操作房间");
        }
    }
}
